<?php
// for member variables, 
// see http://codex.wordpress.org/Function_Reference/get_the_category
/*
term_ID 
    the category id (also stored as 'term_id') 
cat_name 
    the category name (also stored as 'name') 
category_nicename 
    a slug generated from the category name (also stored as 'slug') 
category_description 
    the category description (also stored as 'description') 
category_parent 
    the category id of the current category's parent. '0' for no parents. (also stored as 'parent') 
category_count 
    the number of uses of this category (also stored as 'count') 
*/

class Category
{
    private $_item;
    private $_id;

    function __construct( $item )
    {
        // var_dump($item);
        $this->_id = $item->term_ID;
        $this->_item = $item;
    }

    public function Dump()
    {
        var_dump($this->_item);
    }

    public function ID()
    {
        return $this->_item->_id;
    }

    public function Name()
    {
        return $this->_item->cat_name;
    }

    public function NiceName()
    {
    }

    public function ParentID()
    {
        return $this->_item->parent;
    }

    public function UseCount()
    {
        return $this->_item->category_count;
    }

    public function Slug()
    {
        return $this->_item->nice_name;
    }

    public function Description()
    {
        return $this->_item->category_description;
    }

    public function Children()
    {
        $kids = array();
        $arg = "child_of=" . $this->_id;
        $cats = get_categories( $arg );
        foreach( $cats as $kid ) {
            $kids[] = new Category( $kid );
        }
        return $kids ;
    }
}

class SlugCategory extends Category
{
    function __construct( $slug )
    {
        $cat = get_category_by_slug( $slug );
        $this->__construct( get_category( $cat ) );
        // $this->_item = get_category( $id );
    }
}

?>
